import _axios from "@/plugins/axios";


// 购物车-添加
export function cartAdd({ channel, quantity, remarks, skuNo, spuNo, expressFee, imageRemarks, manuaAdjustRemark, manuaPrice, manuaAdjustImage, manuaExpressFee, services, videoServices, notSupportQcVideos, source, activityId }) {
    return _axios({
        url: '/shopcart/addV2',
        method: 'post',
        data: {
            channel, // 商品ID，必填
            quantity, // 数量，必填
            remarks,
            skuNo, // 商品规格id，必填
            spuNo,
            expressFee,
            imageRemarks,
            manuaAdjustRemark,//改价备注
            manuaPrice,//改价价格
            manuaAdjustImage,//改价图片
            manuaExpressFee,
            services,//定制照片
            videoServices,//定制视频
            notSupportQcVideos,
            source,//1-现有平台 2-双十一活动 4-拼团"
            activityId //活动ID
        }
    })
}

// 购物车-结算
export function cartBalanceAccounts(ids) {
    return _axios({
        url: '/order/generatePreOrderNo',
        method: 'post',
        data: ids
    })
}
// 购物车-结算-预下单
export function preOrder(ids) {
    return _axios({
        url: '/order/pre/order',
        method: 'post',
        data: ids
    })
}


// 购物车-批量删除
export function cartDeleteBatch(ids) {
    return _axios({
        url: '/shopcart/deleteBatch',
        method: 'delete',
        data: ids
    })
}


// 购物车-编辑
export function cartEdit({
    channel,
    id,
    skuNo,
    quantity,
    spuNo,
    remarks,
    imageRemarks,
    manuaAdjustRemark,
    manuaPrice,
    manuaAdjustImage
}) {
    return _axios({
        url: '/shopcart/editV2',
        method: 'put',
        data: {
            channel, // 来源
            id, // 主键
            skuNo, // 系统商品编号/货号：系统唯一
            quantity, // 数量，必填
            spuNo, // SPU产品编号
            remarks, // 编辑商品
            imageRemarks,
            manuaAdjustRemark,//改价备注
            manuaPrice,//改价价格
            manuaAdjustImage,//改价图片
        }
    })
}

// 订单-编辑
export function orderEdit({
    imageRemarks,
    orderItemId,
    remarks
}) {
    return _axios({
        url: '/order/editRemarks',
        method: 'post',
        data: {
            imageRemarks,
            orderItemId,
            remarks
        }
    })
}


// 购物车-列表查询
export function cartList() {
    return _axios({
        url: '/shopcart/listV2',
        method: 'get'
    })
}

// 订单-编辑
export function orderItemRejectClearBalance({ orderItemId }) {
    return _axios({
        url: '/order/orderItemRejectClearBalance',
        method: 'post',
        data: { orderItemId }
    })
}